package com.geekaca.d06;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class TestMaPlOOP {
    public static void main(String[] args) {
        Map<String, Integer> map = new HashMap<>();
        // 添加元素
        map.put("娃哈哈", 30);
        map.put("iphoneX", 100);
        map.put("huawei", 1000);
        map.put("生活用品", 10);
        map.put("手表", 10);

        Set<String> keySet = map.keySet();
        for (String key : keySet) {
            System.out.println(key + ":" + map.get(key));
        }

        map.keySet().forEach(key -> {
            System.out.println(map.get(key));
        });

        map.forEach((k, v) -> System.out.println(k + ":" + v));


    }
}
